/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package sismol.cartography;

import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;

/**
 *
 * @author koji
 */
@Entity
public class Ponto implements Serializable {

    private static final long serialVersionUID = 1L;
    private Long id;

    private String nome;

    private Boolean parada;

    private Double latitude;
    private Double longitude;

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    public Boolean getParada() {
        return parada;
    }

    public void setParada(Boolean parada) {
        this.parada = parada;
    }

    public Double getLatitude() {
        return latitude;
    }

    public void setLatitude(Double latitude) {
        this.latitude = latitude;
    }

    public Double getLongitude() {
        return longitude;
    }

    public void setLongitude(Double longitude) {
        this.longitude = longitude;
    }

    public boolean proximo(Double latitude, Double longitude) {
        if (latitude.equals(this.latitude) && longitude.equals(this.longitude)) {
            return true;
        }
        return false;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Ponto other = (Ponto) obj;
        if ((this.nome == null) ? (other.nome != null) : !this.nome.equals(other.nome)) {
            return false;
        }
        if (this.latitude != other.latitude && (this.latitude == null || !this.latitude.equals(other.latitude))) {
            return false;
        }
        if (this.longitude != other.longitude && (this.longitude == null || !this.longitude.equals(other.longitude))) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 53 * hash + (this.nome != null ? this.nome.hashCode() : 0);
        hash = 53 * hash + (this.latitude != null ? this.latitude.hashCode() : 0);
        hash = 53 * hash + (this.longitude != null ? this.longitude.hashCode() : 0);
        return hash;
    }

    

    @Override
    public String toString() {
        return "sismol.cartography.Point[id=" + id + "]";
    }

}
